import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:jetour_line/utils/extension_int.dart';

import '../my_colors.dart';

class LoadingWidget extends StatefulWidget {
  final String? errorMsg;
  final Function? refFun;
  final int? type; //0 loading  1 暂无数据  2刷新

  const LoadingWidget({
    this.errorMsg = "暂无数据", this.refFun,this.type = 0
  });

  @override
  _LoadingWidgetState createState() => _LoadingWidgetState();
}

class _LoadingWidgetState extends State<LoadingWidget> {

  @override
  Widget build(BuildContext context) {
    print("list != null && list!.isEmptylist != null && list!.isEmptylist != null && list!.isEmptylist != null && list!.isEmpty${widget.type}");
    return Center(
      child:widget.type == 0?CircularProgressIndicator(
        backgroundColor: Colors.white,
        strokeWidth: 4.0,
        valueColor: AlwaysStoppedAnimation<Color>(MyColors.appColor),
      ):widget.type == 1?Text(widget.errorMsg!,style: TextStyle(fontSize: 30.px,color: MyColors.color666666),):Column(children: [
        Text(widget.errorMsg!,style: TextStyle(fontSize: 30.px,color: MyColors.color666666),),

      ],),
    );
  }
}
